package cn.echo.ecc.fallback;

import cn.echo.ecc.domain.User;
import cn.echo.ecc.enums.GlobalExceptionCode;
import cn.echo.ecc.exception.GlobalCustomException;
import cn.echo.ecc.feign.UserService;
import cn.echo.ecc.result.JSONResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class UserServiceFallbackFactory implements FallbackFactory<UserService> {
    @Override
    public UserService create(Throwable throwable) {
        return new UserService() {

            @Override
            public JSONResult listUser(Object[] ids) {
                return JSONResult.error(GlobalExceptionCode.FAIL);
            }

            @Override
            public JSONResult get(Long id) {
                return JSONResult.error(GlobalExceptionCode.FAIL);
            }
        };
    }
}
